<?php

namespace app\common\repositories\repair;

use app\common\repositories\BaseRepository;
use app\common\dao\repair\RepairPictureDao;

/**
 * Class RepairPictureRepository
 *
 * @mixin RepairPictureDao
 */
class RepairPictureRepository extends BaseRepository
{


    public function __construct(RepairPictureDao $dao)
    {
        $this->dao = $dao;
    }

    /**
     * 添加报修图片
     * @param int $repairId 报修ID
     * @param array $data 报修图片
     * @return int
     */
    public function addRepairPicture(int $repairId, array $data, int $isType = 1)
    {
        $insertData = [];
        foreach ($data as $k => $v) {
            $insertData[] = [
                'is_type' => $isType,
                'repair_id' => $repairId,
                'show_src' => $v
            ];
        }
        return $this->dao->insertAll($insertData);
    }

}
